home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / NGL2.0.1J(68k).sit / NGL2.0.1J(68k) / Sprite Sample / Sprite_Sample.c < prev    next >
C/C++ Source or Header  |  1996-09-16  |  3KB  |  69 lines

  1. /*============================================================
  2.  
  3.                     N_Sprite サンプルプログラム
  4.                     
  5. ============================================================*/
  6.  
  7. #include        "N_Library.h"
  8.  
  9. short        Data_Rsrc = 0;
  10. long            counter = 0;
  11.  
  12. void main(void)
  13. {
  14.     WindowPtr    window;
  15.     short        x,y;
  16.     long            ww;
  17.     
  18.     ToolboxInit();
  19.     ColorCheck();
  20.     HideMenuBar();
  21.     window = GetNewWindow (128,nil,(WindowPtr)-1L );
  22.     N_Window_Set(window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),640,480);
  23.     Open_Resource_File(128,1,&Data_Rsrc);
  24.     N_Pict_Draw(128,0,0,(GrafPtr)Main_Window,true);
  25.     N_Sprite_Set(129,0,128,128,0,1,1,0);                                            //スプライト登録 (0-3)
  26.     N_Sprite_Set(130,1,128,128,0,1,1,0);
  27.     N_Sprite_Set(131,2,32,32,0,1,1,0);
  28.     N_Sprite_Set(132,3,32,32,0,1,1,0);
  29.     Close_Resource_File(&Data_Rsrc);
  30.  
  31.     HideCursor();
  32.     Delay(60,&ww);
  33.     do
  34.     {
  35.  
  36.     x = (GetRandom(0,700) -60);
  37.     y = (GetRandom(0,540) -60);
  38.  
  39.     if (counter>=0 && counter<500*2)            N_Sp_Put_Win(0x00000000,x,y);                //SP0 ノーマル・上書き
  40.     if (counter>=500*2 && counter<1000*2    )    N_Sp_Put_Win(0x00010000,x,y);                //SP0 水平反転・上書き
  41.     if (counter>=1000*2 && counter<1500*2)    N_Sp_Put_Win(0x00020000,x,y);                //SP0 垂直反転・上書き
  42.     if (counter>=1500*2 && counter<2000*2)    N_Sp_Put_Win(0x00030000,x,y);                //SP0 水平・垂直反転・上書き
  43.  
  44.     if (counter>=2000*2 && counter<6000*2)    N_Sp_Put_Win(0x00000002,x,y);                //SP2 ノーマル・上書き
  45.     if (counter>=6000*2 && counter<10000*2)    N_Sp_Put_Win(0x00010002,x,y);                //SP2 水平反転・上書き
  46.     if (counter>=10000*2 && counter<14000*2)    N_Sp_Put_Win(0x00020002,x,y);                //SP2 垂直反転・上書き
  47.     if (counter>=14000*2 && counter<18000*2)    N_Sp_Put_Win(0x00030002,x,y);                //SP2 水平・垂直反転・上書き
  48.  
  49.     if (counter>=18000*2 && counter<18500*2)    N_Sp_Put_Win(0x80000001,x,y);                //SP1 ノーマル・重ね書き
  50.     if (counter>=18500*2 && counter<19000*2)    N_Sp_Put_Win(0x80010001,x,y);                //SP1 水平反転・重ね書き
  51.     if (counter>=19000*2 && counter<19500*2)    N_Sp_Put_Win(0x80020001,x,y);                //SP1 垂直反転・重ね書き
  52.     if (counter>=19500*2 && counter<20000*2)    N_Sp_Put_Win(0x80030001,x,y);                //SP1 水平・垂直反転・重ね書き
  53.  
  54.     if (counter>=20000*2 && counter<24000*2)    N_Sp_Put_Win(0x80000003,x,y);                //SP3 ノーマル・重ね書き
  55.     if (counter>=24000*2 && counter<28000*2)    N_Sp_Put_Win(0x80010003,x,y);                //SP3 水平反転・重ね書き
  56.     if (counter>=28000*2 && counter<32000*2)    N_Sp_Put_Win(0x80020003,x,y);                //SP3 垂直反転・重ね書き
  57.     if (counter>=32000*2 && counter<36000*2)    N_Sp_Put_Win(0x80030003,x,y);                //SP3 水平・垂直反転・重ね書き
  58.  
  59.     if (counter>=72000) counter = 0;
  60.     counter++;
  61.  
  62.     }
  63.     while (!Button());
  64.     ShowMenuBar();
  65.     ShowCursor();
  66.     ColorRevert();
  67. }
  68.  
  69.